/*
 *  按键和触屏事件回调接口定义
 *
 *  注意:
 *      1.该类只会被上层实例化一次,无需考虑重入问题
 */
#ifndef _PLAT_INPUT_BASE_H_
#define _PLAT_INPUT_BASE_H_

#include <stdbool.h>

//长按反复触发事件时间间隔ms
#define PLAT_INPUT_INTERVAL_MS 50

//输入按键类型
typedef enum {
    PIK_UP,
    PIK_DOWN,
    PIK_LEFT,
    PIK_RIGHT,

    PIK_BACK,
    PIK_HOME,

    //可选
    PIK_UP_LEFT,
    PIK_UP_RIGHT,
    PIK_DOWN_LEFT,
    PIK_DOWN_RIGHT,

    PIK_ARROW_UP,
    PIK_ARROW_DOWN,
    PIK_ARROW_LEFT,
    PIK_ARROW_RIGHT,

} PlatInputKey;

//输入按键/触屏状态
typedef enum {
    PIS_UP, //松开
    PIS_DOWN, //按下
    PIS_HOLD, //维持/移动
} PlatInputState;

//按键回调
typedef void (*PlatKeyCallback)(void *priv, PlatInputKey key, PlatInputState state);
//触屏回调(x,y为触屏坐标)
typedef void (*PlatTouchCallback)(void *priv, int32_t x, int32_t y, PlatInputState state);

class PlatInputBase
{
public:
    virtual ~PlatInputBase() {}

    // ----- 提供接口 -----

    virtual void SetKeyCallback(void *priv, PlatKeyCallback callback) = 0;
    virtual void SetTouchCallback(void *priv, PlatTouchCallback callback) = 0;

    virtual void KeyCallbackEnable(bool enable) = 0;
    virtual void TouchCallbackEnable(bool enable) = 0;
};

#endif // _PLAT_INPUT_BASE_H_
